package cp3120.view;

import cp3120.dao.DAOFactory;
import cp3120.model.Airport;
import generic.swing.ListView;
import java.util.List;

/**
 * A Panel that displays a FlightTableUI
 * @see FlightTableUI
 * @author Adam Scarr
 * @since r1
 */
public class AirportList extends ListView<Airport> {
    protected List<Airport> getList() {
        return DAOFactory.getFlightDAO().getAirports();
    }

    protected void delete(Airport airport) {
        DAOFactory.getFlightDAO().deleteAirport(airport);
    }

    protected void edit(Airport airport) {
        new AirportEditor(airport).setVisible(true);
    }

    protected void add() {
        new AirportEditor(new Airport()).setVisible(true);
    }

    protected void ok() {
        dispose();
    }

}
